Conversation
There was a problem hiding this comment.
Pull request overview
Updates tt-mlir’s pinned LLVM/StableHLO/Shardy revisions and applies the required mechanical codebase adjustments to build against the uplifted dependencies (notably MLIR builder API and header path changes).
Changes:
- Bump external dependency SHAs for LLVM, StableHLO, and Shardy in the toolchain environment.
- Update many MLIR op construction sites from
builder.create<Op>(...)toOp::create(...)and related API adjustments (e.g.,llvm::make_scope_exit→llvm::scope_exit). - Fix include path changes for MLIR passes (e.g., Affine passes header move) and update ancillary build/config files.
Reviewed changes
Copilot reviewed 146 out of 146 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unittests/Validation/TestOpConstraintValidation.cpp | Mechanical switch to Op::create in validation unit tests. |
| test/unittests/TestScheduler/TestScheduler.cpp | Mechanical switch to Op::create in scheduler unit tests. |
| test/unittests/Support/TTPrintIRInstrumentationTest.cpp | Mechanical switch to Op::create in instrumentation unit tests. |
| test/unittests/Optimizer/TestShardSolver.cpp | Mechanical switch to Op::create in optimizer unit tests. |
| test/unittests/Optimizer/TestLegalTensorLayoutAnalysis.cpp | Mechanical switch to Op::create in layout analysis unit tests. |
| test/unittests/Optimizer/TestLegalLayoutAnalysis.cpp | Mechanical switch to Op::create in layout analysis unit tests. |
| test/unittests/Optimizer/TestGreedyL1InterleavedPolicy.cpp | Mechanical switch to Op::create in policy unit tests. |
| test/unittests/OpModel/TTNN/Op/TestMatmulBlockShardedConstraint.cpp | Mechanical switch to Op::create in op model unit tests. |
| test/unittests/Allocation/TestGenericOpBufferAnalysis.cpp | Mechanical switch to Op::create in allocation/buffer analysis unit tests. |
| python/CMakeLists.txt | Update MLIR python extension CMake configuration for uplifted LLVM/MLIR. |
| lib/Transforms/ConstEvalHoist.cpp | Mechanical switch to Op::create in const-eval hoisting transform. |
| lib/Transforms/CollapseParallelLoops.cpp | Mechanical switch to Op::create in loop-collapsing transform. |
| lib/Dialect/TTNN/Utils/TransformUtils.cpp | Mechanical switch to Op::create in TTNN transform utilities. |
| lib/Dialect/TTNN/Utils/PassOverrides.cpp | Add missing include(s) required after uplift (StringMap). |
| lib/Dialect/TTNN/Transforms/Workarounds/TTNNWorkaroundsPatterns.cpp | Mechanical switch to Op::create in workaround patterns. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/UpsampleOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/SubtractOpImplicitBroadcastRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ScatterOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ScaledDotProductAttentionPadTileDimsRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/RotaryEmbeddingOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ReduceScatterOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/RMSNormConfigRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/PointToPointOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/PagedUpdateCacheOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/MultiplyOpDecompositionRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/LinearOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ExplicateOperandBroadcastsRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/DistributedRMSNormWidthShardInputRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/CumSumOpRankRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/CumSumOpDimRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/Conv3dPadOutputChannelsRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/Conv3dDepthPaddingRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ConcatenateHeadsOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ConcatOpReshapeRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ConcatOpDecompositionRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/ArgMaxOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/Workarounds/Decomposition/AllGatherOpRewritePattern.cpp | Mechanical switch to Op::create in decomposition rewrite. |
| lib/Dialect/TTNN/Transforms/TTNNWeightBFP8Conversion.cpp | Mechanical switch to Op::create in BFP8 conversion transform. |
| lib/Dialect/TTNN/Transforms/TTNNTraceHoistTransform.cpp | Mechanical switch to Op::create and related updates in trace hoisting. |
| lib/Dialect/TTNN/Transforms/TTNNToPython.cpp | Use llvm::scope_exit after uplift. |
| lib/Dialect/TTNN/Transforms/TTNNToCpp.cpp | Use llvm::scope_exit after uplift. |
| lib/Dialect/TTNN/Transforms/TTNNRecoverStructure.cpp | Mechanical switch to Op::create in structure recovery transform. |
| lib/Dialect/TTNN/Transforms/TTNNLayout.cpp | Mechanical switch to Op::create in layout transform. |
| lib/Dialect/TTNN/Transforms/TTNNFusing.cpp | Mechanical switch to Op::create in fusing patterns. |
| lib/Dialect/TTNN/Transforms/TTNNDecomposeLayouts.cpp | Mechanical switch to Op::create in layout decomposition. |
| lib/Dialect/TTNN/Transforms/TTNND2MFusing.cpp | Mechanical switch to Op::create in TTNN↔D2M fusing. |
| lib/Dialect/TTNN/Transforms/TTNNConstEvalInputsToSystemMemory.cpp | Mechanical switch to Op::create in const-eval input handling. |
| lib/Dialect/TTNN/Transforms/Passes.cpp | Mechanical switch to Op::create in TTNN transforms and helpers. |
| lib/Dialect/TTNN/Transforms/OptimizerPasses/TTNNPrepareConv2dWeightsAndBias.cpp | Mechanical switch to Op::create in optimizer pass. |
| lib/Dialect/TTNN/Transforms/OptimizerPasses/Optimizer.cpp | Mechanical switch to Op::create in optimizer implementation. |
| lib/Dialect/TTNN/Transforms/OptimizerPasses/OperationValidationAndFallback.cpp | Mechanical switch to Op::create in validation/fallback logic. |
| lib/Dialect/TTNN/Transforms/OptimizerPasses/DevicePassesWrapper.cpp | Use llvm::scope_exit after uplift. |
| lib/Dialect/TTNN/Transforms/Fusing/RoPEFusingPattern.cpp | Mechanical switch to Op::create in RoPE fusing. |
| lib/Dialect/TTMetal/Pipelines/TTMetalPipelines.cpp | Update MLIR include path for Affine passes after uplift. |
| lib/Dialect/TTKernel/Transforms/InsertDeviceZoneScopes.cpp | Mechanical switch to Op::create for EmitC verbatim insertion. |
| lib/Dialect/TTKernel/Transforms/ControlDstSection.cpp | Mechanical switch to Op::create for TTKernel ops. |
| lib/Dialect/TTIR/Utils/Utils.cpp | Mechanical switch to Op::create in TTIR utilities. |
| lib/Dialect/TTIR/Transforms/ReductionForceKeepDim.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/QuantDequantConversion.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/MoveReshapeToConstant.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/HoistCPUOps/HoistCPUOps.cpp | Mechanical switch to Op::create in TTIR CPU hoist path. |
| lib/Dialect/TTIR/Transforms/FlattenSlidingWindow.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/ExplicateTMs.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/SliceCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/ReduceCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/RMSNormCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/ElementwiseCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/ConcatCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/EraseInverseOps/BroadcastCommutePatterns.cpp | Mechanical switch to Op::create in TTIR canonicalization. |
| lib/Dialect/TTIR/Transforms/ElementTypeNormalization.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/DecomposeComplexReshape.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Transforms/Broadcast.cpp | Mechanical switch to Op::create in TTIR transform. |
| lib/Dialect/TTIR/Pipelines/TTIRPipelines.cpp | Update MLIR include path for Affine passes after uplift. |
| lib/Dialect/TTIR/IR/TTIROps.cpp | Mechanical switch to Op::create in TTIR op implementations. |
| lib/Dialect/TTIR/IR/TTIRDialect.cpp | Mechanical switch to Op::create in dialect materialization. |
| lib/Dialect/TTCore/Transforms/TTCoreRegisterDevice.cpp | Mechanical switch to Op::create in TTCore transform. |
| lib/Dialect/TTCore/Transforms/TTCoreModuleWrap.cpp | Mechanical switch to Op::create in TTCore transform. |
| lib/Dialect/TTCore/IR/Utils.cpp | Mechanical switch to Op::create in TTCore utilities. |
| lib/Dialect/StableHLO/Utils/StableHLOUtils.cpp | Mechanical switch to Op::create in StableHLO utilities. |
| lib/Dialect/StableHLO/Utils/ShardyUtils.cpp | Mechanical switch to Op::create in Shardy utilities integration. |
| lib/Dialect/StableHLO/Transforms/WrapUnderManualComputation.cpp | Mechanical switch to Op::create in StableHLO transform. |
| lib/Dialect/StableHLO/Transforms/StableHLOFusing.cpp | Mechanical switch to Op::create in StableHLO fusing. |
| lib/Dialect/StableHLO/Transforms/ShardyCCLToStableHLOCCLPatterns.cpp | Mechanical switch to Op::create in Shardy→StableHLO lowering. |
| lib/Dialect/StableHLO/Transforms/ShardyCCLCanonicalization.cpp | Mechanical switch to Op::create in Shardy canonicalization. |
| lib/Dialect/D2M/Utils/Utils.cpp | Mechanical switch to Op::create in D2M utilities. |
| lib/Dialect/D2M/Transforms/SplitUnifiedThread.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/ScheduleDMA.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/ScalarizeConstTensors.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/RankNormalization.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/MaterializeViewReturns.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/LowerToExplicitForm.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/LowerScratchAllocate.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/LowerMulticastLoads.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/LowerLoadStoreOpsToExplicitCBForm.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/InsertStreams.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/GridSelection.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/GlobalDataFormatConversion.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/GenericRegionsToFuncs.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/GenericLinearizeMemref.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/GenerateOuterLoops.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/ElementwiseFusion.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/DecomposeMasking.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/DecomposeComplexPermute.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/DecomposeArange.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/ConvertLocalLoadStoreOpsToAliasedCBs.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/Allocate.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/Transforms/AddScratchInputs.cpp | Mechanical switch to Op::create in D2M transform. |
| lib/Dialect/D2M/IR/D2MOps.cpp | Mechanical switch to Op::create in D2M op bufferization. |
| lib/Dialect/D2M/IR/D2MGenericRegionOps.cpp | Mechanical switch to Op::create in D2M region op bufferization. |
| lib/Conversion/TTNNToEmitPy/TTNNToEmitPyPass.cpp | Mechanical switch to Op::create in EmitPy conversion pass. |
| lib/Conversion/TTNNToEmitPy/TTNNToEmitPy.cpp | Mechanical switch to Op::create in EmitPy conversion patterns. |
| lib/Conversion/TTNNToEmitC/TTNNToEmitCPass.cpp | Mechanical switch to Op::create in EmitC conversion pass. |
| lib/Conversion/TTKernelToEmitC/TTKernelToEmitC.cpp | Mechanical switch to Op::create in TTKernel→EmitC lowering. |
| lib/Conversion/TTIRToTTNN/Utils.cpp | Mechanical switch to Op::create in TTIR→TTNN utilities. |
| lib/Conversion/StableHLOToTTIR/StableHLOLegalizeCompositePass.cpp | Mechanical switch to Op::create in StableHLO→TTIR legalization. |
| lib/Conversion/StableHLOToTTIR/ShardyToTTIRPatterns.cpp | Mechanical switch to Op::create in Shardy→TTIR patterns. |
| lib/Conversion/SFPIToEmitC/SFPIToEmitC.cpp | Mechanical switch to Op::create in SFPI→EmitC lowering. |
| lib/Conversion/D2MToTTMetal/D2MToTTMetal.cpp | Mechanical switch to Op::create in D2M→TTMetal lowering. |
| lib/Conversion/ArithToD2MTileOps/ArithToD2MTileOps.cpp | Mechanical switch to Op::create in Arith→D2M tile lowering. |
| include/ttmlir/Support/IRHasher.h | Use llvm::scope_exit after uplift. |
| include/ttmlir/Dialect/TTNN/Utils/PassOverrides.h | Add missing include(s) required after uplift (StringMap). |
| include/ttmlir/Dialect/TTNN/Utils/OptimizerOverrides.h | Add missing include(s) required after uplift (StringMap). |
| include/ttmlir/Dialect/TTIR/Utils/Utils.h | Update helper templates/docs to use Op::create patterns. |
| include/ttmlir/Dialect/TTIR/Transforms/EraseInverseOps/EraseInverseOps.h | Mechanical switch to Op::create in header helpers. |
| include/ttmlir/Dialect/D2M/IR/D2MGenericRegionOps.td | Update generated bufferization snippet to ToBufferOp::create. |
| include/ttmlir/Conversion/TTNNToEmitPy/EmitPyConversion.h | Mechanical switch to Op::create in EmitPy conversion header. |
| include/ttmlir/Conversion/TTNNToEmitC/EmitCConversion.h | Mechanical switch to Op::create in EmitC conversion header. |
| include/ttmlir/AffineMapUtils.h | Mechanical switch to AffineApplyOp::create helper. |
| env/patches/shardy_mpmd_pybinds.patch | Patch adjustments for Shardy mpmd pybinds with uplifted deps. |
| env/CMakeLists.txt | Update pinned LLVM/StableHLO/Shardy SHAs and toolchain build patch steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Value input1 = | ||
| builder.create<ttir::EmptyOp>(builder.getUnknownLoc(), memrefType1) | ||
| ttir::EmptyOp::create(builder, builder.getUnknownLoc(), memrefType1) | ||
| ->getResult(0); |
There was a problem hiding this comment.
ttir::EmptyOp::create(...) returns a Value in this codebase (e.g., used as Value pooledEmpty = ttir::EmptyOp::create(...) elsewhere), so calling ->getResult(0) here will not compile. Assign the returned Value directly (or, if you intend to get the op, use the appropriate API consistently).
| Value input2 = | ||
| builder.create<ttir::EmptyOp>(builder.getUnknownLoc(), memrefType2) | ||
| ttir::EmptyOp::create(builder, builder.getUnknownLoc(), memrefType2) | ||
| ->getResult(0); |
There was a problem hiding this comment.
Same issue as above: ttir::EmptyOp::create(...) is used as returning a Value elsewhere, so ->getResult(0) here is very likely a compile error. Use the returned Value directly.
| Value output = | ||
| builder.create<ttir::EmptyOp>(builder.getUnknownLoc(), memrefType3) | ||
| ttir::EmptyOp::create(builder, builder.getUnknownLoc(), memrefType3) | ||
| ->getResult(0); |
There was a problem hiding this comment.
Same issue as above for output: ttir::EmptyOp::create(...) should be used as the Value result, not dereferenced with ->getResult(0).
b1a74cc to
2e95418
Compare
|
1157ea2 to
c7da6d2
Compare
env/patches/shardy.patch
Outdated
| // Helper to check if reduction window dim can be a passthrough dim. | ||
| // When window size is 1, stride is 1 and there is no padding on the operand, it | ||
| -// is a 1-1 mapping between operand and result. | ||
| +// is a 1-1 mapping between operand and instead of kReduction which would insert all-reduce after gather. |
There was a problem hiding this comment.
Some of these comments don't make much sense.
There was a problem hiding this comment.
They are comments from the shardy repo 🤷
There was a problem hiding this comment.
Yeah maybe this was the AI going off the rails, afaict the shardy repo comment still reads the old way https://github.com/openxla/shardy/blob/57c7d0deb44d2e29cfffc49f75892eab91357c89/shardy/dialect/sdy/transforms/propagation/op_sharding_rule_registry.cc#L55
c7da6d2 to
b2e0a2b
Compare
b2e0a2b to
8cc488a
Compare
vmilosevic
left a comment
There was a problem hiding this comment.
Clang-Tidy found issue(s) with the introduced code (1/1)
|
|
||
| auto emptyOp = rewriter.create<ttnn::EmptyOp>( | ||
| op.getLoc(), emptyTensorType, device, | ||
| auto emptyOp = ttnn::EmptyOp::create( |
There was a problem hiding this comment.
create is deprecated: Use OpTy::create instead
|
|
||
| auto emptyOp = rewriter.create<ttnn::EmptyOp>( | ||
| op.getLoc(), emptyTensorType, device, | ||
| auto emptyOp = ttnn::EmptyOp::create( |
There was a problem hiding this comment.
create<mlir::tt::ttnn::EmptyOp, mlir::RankedTensorType &, mlir::tt::ttnn::GetDeviceOp &, mlir::tt::ttnn::ShapeAttr, mlir::tt::ttcore::DataTypeAttr, mlir::tt::ttnn::LayoutAttr, mlir::tt::ttnn::MemoryConfigAttr &> is deprecated: Use OpTy::create instead
8cc488a to
413bc25
Compare
### Problem description TT-MLIR compiler references the following external projects: - LLVM - StableHLO - Shardy Last successful uplift was: #5282 ### What's changed Integrating the fresh LLVM, StableHLO, and Shardy versions in the tt-mlir compiler. LLVM: 1053047a4be7d1fece3adaf5e7597f838058c947 StableHLO: 43550117525e77084ac1f83ba50febc0688f7958 Shardy: 4069e470c94d7b08f129ef1607aa2be8f4c06b53
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
413bc25 to
aef3b08
Compare
Problem description
TT-MLIR compiler references the following external projects:
Last successful uplift was:
#5282
What's changed
Integrating the fresh LLVM, StableHLO, and Shardy versions in the tt-mlir compiler.
LLVM: 1053047a4be7d1fece3adaf5e7597f838058c947
StableHLO: 43550117525e77084ac1f83ba50febc0688f7958
Shardy: 4069e470c94d7b08f129ef1607aa2be8f4c06b53